import type { ProfileDetail, ProfileParams } from '@/types/profile'
import http from '@/utils/https'

/**
 * 获取用户信息详情
 * @returns { Promise }
 */
export function getProfileDetailsAPI() {
  return http<ProfileDetail>({
    method: 'GET',
    url: '/member/profile',
  })
}

/**
 * 修改用户信息
 * @param {Object} params
 * @param {string} [params.nickname] - 昵称
 * @param {string} [params.gender] - 性别
 * @param {string} [params.birthday] - 生日
 * @param {string} [params.provinceCode] - 省份编码
 * @param {string} [params.cityCode] - 城市编码
 * @param {string} [params.countyCode] - 区/县编码
 * @param {string} [params.profession] - 职业
 * @returns { Promise }
 */
export function putMemberProfileAPI(params: ProfileParams) {
  return http<ProfileDetail>({
    method: 'PUT',
    url: '/member/profile',
    data: params,
  })
}
